<h2>User Details</h2>
<table class="list-display">
  <tr>
    <th width=120 align=left>Username</th>
    <th width=200 align=left>Name</th>
    <th width=200 align=left>Email</th>
    <th width=200 align=left>Admin</th>
    <th width=200 aligh=left>Active</th>
  </tr>
  <tr>
    <td><%= @user.username %></td>
    <td><%= @user.name %></td>
    <td><a href=mailto:<%= @user.email %>><%= @user.email %></a></td>
    <td><%= @user.is_admin %></td>
    <td><%= @user.is_active %></td>
  </tr>
  <tr>
    <th align=left colspan="5">Posts</th>
  </tr>
  <% @posts = Post.where(:user_id => @user.id, :post_id => nil) %>
  <tr>
    <td colspan="4" align=left><b>Question</b></td>
    <td align=left><b>Date Created</b></td>
  </tr>
  <% @posts.each do |post| %>
      <tr valign="top">
        <td colspan="4"><%= post.data.length > 100 ? "#{post.data[0..100]}..." : post.data %></td>
        <td><%= post.created_at.localtime.to_formatted_s(:long) %></td>
      </tr>
  <% end %>
  <tr>
    <th align=left colspan="5">Replies</th>
  </tr>
  <% @replies = Post.all(:conditions => "post_id IS NOT NULL and user_id = #{@user.id}"  ) %>
  <tr>
    <td colspan="4" align=left><b>Reply</b></td>
    <td align=left><b>Date Replied</b></td>
  </tr>
  <% @replies.each do |reply| %>
      <tr class="reply" valign="top">
        <td colspan="4"><%= reply.data.length > 100 ? "#{reply.data[0..100]}..." : reply.data %></td>
        <td><%= reply.created_at.localtime.to_formatted_s(:long) %></td>
      </tr>
  <% end %>
  <tr>
    <th align=left colspan="5">Votes</th>
  </tr>
  <% @votes = Vote.where(:user_id => @user) %>
  <tr>
    <td colspan="4" align=left><b>Post/Reply</b></td>
    <td align=left><b>Date Voted</b></td>
  </tr>
  <% @votes.each do |vote| %>
      <% post = Post.find(vote.post_id) %>
      <tr valign="top">
        <td colspan="4"><%= post.data.length > 100 ? "#{post.data[0..100]}..." : post.data %></td>
        <td><%= vote.created_at.localtime.to_formatted_s(:long) %></td>
      </tr>
  <% end %> </table>  <br/>    <%= link_to 'User Summary', "/reports" %>